{% load cctags %}
{% load ccfilters %}
<head>
    <title>{% _ "Upload Image" %}</title>
{% if user %}
    <style type="text/css" rel="stylesheet">
        #upload_button {
            color: #FFFFFF;
            vertical-align: middle;
            text-align: center;
            border: 1px solid #FEA469;
            border-radius: 5px;
            -moz-border-radius: 5px;
            -webkit-border-radius: 5px;
            background: #FF8C05;
            background: -moz-linear-gradient(top, #FFBB6B 0%, #FF8C05 100%);
            background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #FFBB6B), color-stop(100%, #FF8C05));
            filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFBB6B', endColorstr='#FF8C05',GradientType=0 );
            padding: 2px 16px 2px 16px;
            margin: 5px;
            cursor: pointer;
        }
        #upload_button img{
            vertical-align: text-bottom;
        }
    </style>
    {% block css %}
    {% endblock %}
    {% if site_settings.development %}
        <script type="text/javascript" src="/static/js/jquery-1.8.3.min.js"></script>
    {% else %}
        <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.3.min.js"></script>
    {% endif %}

    {% block scripts %}
    {% endblock %}

    <script type="text/javascript">
        $(document).ready(function(){
            var photo_upload_callback = function(photourl){
                if (photourl){
                    window.returnValue = photourl;
                    window.close();
                }
            };
            var error_handler = function(err){
                alert('{% _ "upload error" %}' + ':' +err);
                window.close();
            };

            init_photo_upload({left:50, top:20, img_type: 'Photo',
                        photo_upload_callback: photo_upload_callback,
                        error_callback:error_handler
            });
        });
    </script>
{% endif %}
</head>

{% if user %}
    {% include "_photo_upload_form.html" %}
{% else %}
    {% _ "Please Login" %}
{% endif %}
